package com.gxa.controller;

import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.gxa.model.ResultData;
import com.gxa.pojo.Grade;
import com.gxa.service.GradeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author 周区区
 * @version 1.0
 * @date 2021/8/3 17:19
 */
@Controller
public class GradeController {
    @Autowired
    private GradeService gradeService;

    /**
     * 查询所有班级信息
     * @return
     */
    @GetMapping("/findAllGra")
    @ResponseBody
    public ResultData findAllGrade(){
        return gradeService.findAllGrade();
    }

    /**
     * 修改班级信息
     * @param grade
     * @return
     */
    @PostMapping("/updGra")
    @ResponseBody
    public ResultData updGrade(@RequestBody Grade grade){
        return gradeService.updGrade(grade);
    }


    @PostMapping("/addGra")
    @ResponseBody
    public ResultData addGrade(@RequestBody Grade grade){
        return gradeService.addGrade(grade);
    }


    @GetMapping("/delGra")
    @ResponseBody
    public ResultData delGrade(@RequestParam("id") Integer gradeId){
        System.out.println("接收到的id："+gradeId);
        return gradeService.delGrade(gradeId);
    }


}
